package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenUserSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerUserAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.user.User;
import com.wlyuan.open.scanner.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.USER)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerUserHandler extends BaseScannerHandler<User, OpenUserSyncDTO> {

    private final UserRepository userRepository;

    @Override
    protected List<User> select() {
        return userRepository.list();
    }

    @Override
    protected List<OpenUserSyncDTO> assembler(List<User> data) {
        return ScannerUserAssembler.assemble(data);
    }


}
